package br.com.wepa.webapps.orca.logica.persistencia;

import java.io.Serializable;
import java.util.List;

import javax.persistence.PersistenceException;

/**
* Data Acess Object Generico 
*/
public interface GenericDAO<T, ID extends Serializable>  {

 T newInstance();
 
 ID newIDInstance();
 
 Class<T> getPersistentClass() ;

 Class<ID> getPersistentIdClass();
 	
 /**
  * 
  * @param id
  * @param lock
  * @return the entity, must return null if not found
  */
 T findById(ID id, boolean lock) throws PersistenceException;
 
 boolean exists(ID id) throws PersistenceException;

 List<T> findAll()throws PersistenceException;

 
 List<T> findByExample(T exampleInstance, String... excludeProperty) throws PersistenceException;

 T findUnique(T exampleInstance, String... excludeProperty) throws PersistenceException;

 ID create(T entity) throws PersistenceException;
 
 void refresh(T entity) throws PersistenceException;
 
 T makePersistent(T entity) throws PersistenceException;

 void makeTransient(T entity) throws PersistenceException;

}